package com.team.engine.common.datasources;

import java.util.Map;

import javax.sql.DataSource;

import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;
import org.springframework.orm.ibatis.SqlMapClientTemplate;

import com.ibatis.sqlmap.client.SqlMapClient;

/**
 * 数据库源，适配类
 * @author MengLH
 * @data 2010-7-6
 */
public abstract class DataSourceAdapter extends HibernateDaoSupport{

//	protected HibernateTemplate hibernateTemplate;
	protected SqlMapClientTemplate sqlMapClientTemplate;
	protected JdbcTemplate jdbcTemplate;
	protected Map<String, String> dataSourceProps;
	
//	public void setSessionFactory(final SessionFactory sessionFactory) {
//        this.hibernateTemplate = new HibernateTemplate(sessionFactory);
//    }
	
	public void setDataSourceProps(Map<String, String> dataSourceProps) {
		this.dataSourceProps = dataSourceProps;
	}

	public void setSqlMapClientTemplate(final SqlMapClient sqlMapClient) {
		this.sqlMapClientTemplate = new SqlMapClientTemplate(sqlMapClient);
	}

    public void setDataSource(final DataSource dataSource) {
        this.jdbcTemplate = new JdbcTemplate(dataSource);
    }

}
